<!-- 项目设备列表 -->
<template>
  <div style="position: relative;"  v-loading='table_Loading'>
    <div style="    position: absolute;
    bottom: -31px;
    z-index: 999;
    font-size: 15px;
    color: red;">按住Shift + 鼠标滚轮使用横向滚动条</div>
    <el-table
     
      @cell-mouse-enter="
        (data, event, a2, a4) => cellMouseEnter(data, event, a2, a4)
      "
      @cell-mouse-leave="cellMouseLeave"
      @selection-change="handleSelectionChange"
      class="mmy-table"
      :header-cell-style="{ background: '#fafbfc', color: '#333333' }"
      :data="tableDatas"
      style="width: 100%"
      :height="activeHeight"
    >
      <el-table-column type="selection" width="30" />
      <el-table-column type="index"  label="序号" fixed width="60" />

      <el-table-column   label="图纸阶段" fixed  width="100">
        <template  #header>
      <div style="display: flex;align-items: center;">
      <div style="margin-right: 5px;">图纸阶段 </div>
      <el-popover  :width="200"
    trigger="hover">
      
        
        <template #reference>
          <div class="icone" :class="drawing_stage.length==0?'':'active'">
        <el-icon><Filter /></el-icon>
      </div>
        </template>
        <el-select-v2
      
        :teleported ='false'
           size="small"
              style="width: 180px; margin-right: 10px;z-index: 2000;"
              clearable
              multiple
              filterable
              collapse-tags
              collapse-tags-tooltip
              :options="[
                {
                  value:'施工图',

                label:'施工图'
                },
                {
                  value:'工程图',

                label:'工程图'
                },


              ]"
              v-model="drawing_stage"
              @change="(text)=>changeFn(text,'drawing_stage')"
              placeholder="请选择"
              
            >
            </el-select-v2>

      </el-popover>
    </div>
      
     </template>
        <template #default="scope">

          <div v-if="!scope.row.drawing_stage || scope.row.drawing_stage=='工程图'">{{ scope.row.drawing_stage }}</div>
          <div v-else style="color:red">{{ scope.row.drawing_stage }}</div>
        </template>
      </el-table-column>
      <el-table-column
        v-for="(head, index) in tableHeader"
        :key="index"
        :prop="head.prop"
        :label="head.label"
        :width="head.width"
        :fixed="head.fixed"
        align="center"
        :sortable="head.sortable"
        show-overflow-tooltip
      >
     <template v-if="head.prop =='equip_unit_no'" #header>
      <div style="display: flex;align-items: center;">
      <div style="margin-right: 5px;">主项 </div>
      <el-popover  :width="200"
    trigger="hover">
      
        
        <template #reference>
          <div class="icone" :class="SelectMajor.length==0?'':'active'">
        <el-icon><Filter /></el-icon>
      </div>
        </template>
        <el-select-v2
        v-if="props.equipOptions.length>0"
        :teleported ='false'
           size="small"
              style="width: 180px; margin-right: 10px;z-index: 2000;"
              clearable
              multiple
              filterable
              collapse-tags
              collapse-tags-tooltip
              :options="props.equipOptions"
              v-model="SelectMajor"
              @change="(text)=>changeFn(text,'SelectMajor')"
              placeholder="请选择主项号"
              
            >
            </el-select-v2>

      </el-popover>
    </div>
      
     </template>

     <template v-if="head.prop =='equip_name'" #header>
      <div style="display: flex;align-items: center;">
      <div style="margin-right: 5px;">设备名称 </div>
      <el-popover  :width="200"
    trigger="hover">
      
        
        <template #reference>
          <div class="icone" :class="equip_nameInput.length==0?'':'active'">
        <el-icon><Filter /></el-icon>
      </div>
        </template>
        <el-select-v2
        v-if="props.nameOptions.length>0"
        :teleported ='false'
           size="small"
              style="width: 180px; margin-right: 10px;z-index: 2000;"
              clearable
              filterable
              multiple
              collapse-tags
              collapse-tags-tooltip
              :options="props.nameOptions"
              v-model="equip_nameInput"
              @change="(text)=>changeFn(text,'equip_nameInput')"
              placeholder="请输入设备名称"
              
            >
            </el-select-v2>

      </el-popover>
    </div>
      
     </template>


     <template v-if="head.prop =='equip_no'" #header>
      <div style="display: flex;align-items: center;">
      <div style="margin-right: 5px;">设备位号 </div>
      <el-popover  :width="200"
    trigger="hover">
      
        
        <template #reference>
          <div class="icone" :class="equipEquip_no.length==0?'':'active'">
        <el-icon><Filter /></el-icon>
      </div>
        </template>
        <el-select-v2
        v-if="props.nameOptions.length>0"
        :teleported ='false'
           size="small"
              style="width: 180px; margin-right: 10px;z-index: 2000;"
              clearable
              filterable
              multiple
              collapse-tags
              collapse-tags-tooltip
              :options="props.equipEquip_no"
              v-model="equipEquip_no"
              @change="(text)=>changeFn(text,'equipEquip_no')"
              placeholder="请输入设备位号"
              
            >
            </el-select-v2>

      </el-popover>
    </div>
      
     </template>


     <template v-if="head.prop =='equip_class'" #header>
      <div style="display: flex;align-items: center;">
      <div style="margin-right: 5px;">设备种类 </div>
      <el-popover  :width="200"
    trigger="hover">
      
        
        <template #reference>
          <div class="icone" :class="equipEquip_class.length==0?'':'active'">
        <el-icon><Filter /></el-icon>
      </div>
        </template>
        <el-select-v2
        v-if="props.equipEquip_class.length>0"
        :teleported ='false'
           size="small"
              style="width: 180px; margin-right: 10px;z-index: 2000;"
              clearable
              filterable
              multiple
              collapse-tags
              collapse-tags-tooltip
              :options="props.equipEquip_class"
              v-model="equipEquip_class"
              @change="(text)=>changeFn(text,'equipEquip_class')"
              placeholder="请输入设备种类"
              
            >
            </el-select-v2>

      </el-popover>
    </div>
      
     </template>


     <template v-if="head.prop =='installation_mode'" #header>
      <div style="display: flex;align-items: center;">
      <div style="margin-right: 5px;">安装方式 </div>
      <el-popover  :width="200"
    trigger="hover">
      
        
        <template #reference>
          <div class="icone" :class="installation_mode_class.length==0?'':'active'">
        <el-icon><Filter /></el-icon>
      </div>
        </template>
        <el-select-v2
        v-if="props.installation_mode_class.length>0"
        :teleported ='false'
           size="small"
              style="width: 180px; margin-right: 10px;z-index: 2000;"
              clearable
              filterable
              multiple
              collapse-tags
              collapse-tags-tooltip
              :options="props.installation_mode_class"
              v-model="installation_mode_class"
              @change="(text)=>changeFn(text,'installation_mode_class')"
              placeholder="请输入设备种类"
              
            >
            </el-select-v2>

      </el-popover>
    </div>
      
     </template>



     <template v-if="head.prop =='equip_designer'" #header>
      <div style="display: flex;align-items: center;">
      <div style="margin-right: 5px;">设计人 </div>
      <el-popover  :width="200"
    trigger="hover">
      
        
        <template #reference>
          <div class="icone" :class="equip_designer_class.length==0?'':'active'">
        <el-icon><Filter /></el-icon>
      </div>
        </template>
        <el-select
        v-if="props.equip_designer_class.length>0"
        :teleported ='false'
           size="small"
              style="width: 180px; margin-right: 10px;z-index: 2000;"
              clearable
              filterable
              multiple
              collapse-tags
              collapse-tags-tooltip
              :options="equip_designer_classPINGYING"
              v-model="equip_designer_class"
              @change="(text)=>changeFn(text,'equip_designer_class')"
              placeholder="请输入"
              :filter-method="matchFruitFirst_equip_designer_class"
            >
            <el-option
              v-for="(item, index) in equip_designer_classPINGYING"
              :key="index"
              :label="item.label"
              :value="item.value"
            />
            </el-select>

      </el-popover>
    </div>
      
     </template>



     <template v-if="head.prop =='equip_checker'" #header>
      <div style="display: flex;align-items: center;">
      <div style="margin-right: 5px;">校核人 </div>
      <el-popover  :width="200"
    trigger="hover">
      
        
        <template #reference>
          <div class="icone" :class="equip_checker_class.length==0?'':'active'">
        <el-icon><Filter /></el-icon>
      </div>
        </template>
        <el-select
        v-if="props.equip_checker_class.length>0"
        :teleported ='false'
           size="small"
              style="width: 180px; margin-right: 10px;z-index: 2000;"
              clearable
              filterable
              multiple
              collapse-tags
              collapse-tags-tooltip
              :options="equip_checker_classPINGYING"
              v-model="equip_checker_class"
              @change="(text)=>changeFn(text,'equip_checker_class')"
              placeholder="请输入"
              :filter-method="matchFruitFirst_equip_checker_class"
            >
            <el-option
              v-for="(item, index) in equip_checker_classPINGYING"
              :key="index"
              :label="item.label"
              :value="item.value"
            />
            </el-select>

      </el-popover>
    </div>
      
     </template>


     <template v-if="head.prop =='auditor'" #header>
      <div style="display: flex;align-items: center;">
      <div style="margin-right: 5px;">审核人 </div>
      <el-popover  :width="200"
    trigger="hover">
      
        
        <template #reference>
          <div class="icone" :class="auditor_class.length==0?'':'active'">
        <el-icon><Filter /></el-icon>
      </div>
        </template>
        <el-select
        v-if="props.auditor_class.length>0"
        :teleported ='false'
           size="small"
              style="width: 180px; margin-right: 10px;z-index: 2000;"
              clearable
              filterable
              multiple
              collapse-tags
              collapse-tags-tooltip
              :options="auditor_classPINGYING"
              v-model="auditor_class"
              @change="(text)=>changeFn(text,'auditor_class')"
              placeholder="请输入"
              :filter-method="matchFruitFirst_auditor_class"
            >
            <el-option
              v-for="(item, index) in auditor_classPINGYING"
              :key="index"
              :label="item.label"
              :value="item.value"
            />
            </el-select>

      </el-popover>
    </div>
      
     </template>



     <template v-if="head.prop =='approver'" #header>
      <div style="display: flex;align-items: center;">
      <div style="margin-right: 5px;">  审定人
      </div>
      <el-popover  :width="200"
    trigger="hover">
      
        
        <template #reference>
          <div class="icone" :class="approver_class.length==0?'':'active'">
        <el-icon><Filter /></el-icon>
      </div>
        </template>
        <el-select
        v-if="props.approver_class.length>0"
        :teleported ='false'
           size="small"
              style="width: 180px; margin-right: 10px;z-index: 2000;"
              clearable
              filterable
              multiple
              collapse-tags
              collapse-tags-tooltip
              :options="approver_classPINGYING"
              v-model="approver_class"
              @change="(text)=>changeFn(text,'approver_class')"
              placeholder="请输入"
              :filter-method="matchFruitFirst_approver_class"
            >
            <el-option
              v-for="(item, index) in approver_classPINGYING"
              :key="index"
              :label="item.label"
              :value="item.value"
            />
            </el-select>
         <div v-else>
          暂无可筛选的人员信息
         </div>
      </el-popover>
    </div>
      
     </template>


    </el-table-column>

      <el-table-column
        prop="equip_lastmodifytime"
        label="最后修改时间"
        align="center"
        sortable
        width="180"
      >
        <template #default="scope">
          <div>{{ changeStr(scope.row.equip_lastmodifytime) }}</div>
        </template>
      </el-table-column>
      <el-table-column fixed="right" label="版本" align="center" width="90">
        <template #default="scope">
          <el-select
            v-model="scope.row.equip_version"
            @change="(text) => revChange(text, scope.row)"
            size="small"
          >
            <el-option
              v-for="(item, index) in scope.row.different"
              :key="index"
              :label="item.label"
              :value="item.value"
            />
          </el-select>
        </template>
      </el-table-column>

 <el-table-column
      sortable
      :sort-method='sortMethod'
        fixed="right"
        :label="tableHeaderStrProps"
        width="120"
        align="center"
      >


      <template  #header>
      <div @click.stop class='move_class' style="display: flex;align-items: center;">
      <div class='my_input_not_send' style="margin-right: 5px;">  <el-input size='small' @blur="changeHeader" v-model='tableHeaderStrProps'></el-input>
      </div>
      <el-popover  :width="200"
    trigger="hover">
      
        
        <template #reference>
          <div class="icone" :class="custom_att1_val_class.length==0?'':'active'">
        <el-icon><Filter /></el-icon>
      </div>
        </template>
        <el-select
       
        v-if="custom_att1_val_classPINGYING.length>0"
        :teleported ='false'
           size="small"
              style="width: 180px; margin-right: 10px;z-index: 2000;"
              clearable
              filterable
              multiple
              collapse-tags
              collapse-tags-tooltip
              :options="custom_att1_val_classPINGYING"
              v-model="custom_att1_val_class"
              @change="(text)=>changeFn(text,'custom_att1_val_class')"
              placeholder="请输入"
            >
            <el-option
              v-for="(item, index) in custom_att1_val_classPINGYING"
              :key="index"
              :label="item.label"
              :value="item.value"
            />
            </el-select>
         <div v-else>
          暂无可筛选的数据
         </div>
      </el-popover>
    </div>
      
     </template>


        <template #default="scope">
          <el-input size="small" @blur='(e)=>changeInput(e,scope.row)' v-model='scope.row.custom_att1_val'></el-input>
        
        </template>
      </el-table-column>
      <el-table-column
        fixed="right"
        label="设计状态"
        width="100"
        align="center"
      >


      <template  #header>
      <div style="display: flex;align-items: center;">
      <div style="margin-right: 5px;">  设计状态
      </div>
      <el-popover  :width="200"
    trigger="hover">
      
        
        <template #reference>
          <div class="icone" :class="equip_check_class.length==0?'':'active'">
        <el-icon><Filter /></el-icon>
      </div>
        </template>
        <el-select
        
        :teleported ='false'
           size="small"
              style="width: 180px; margin-right: 10px;z-index: 2000;"
              clearable
              filterable
              multiple
              collapse-tags
              collapse-tags-tooltip
             
              v-model="equip_check_class"
              @change="(text)=>changeFn(text,'equip_check_class')"
              placeholder="请输入"
             
            >
            <el-option
              v-for="(item, index) in [
             {
                  value:'0',
                 label:'设计中'
                },
                {
                  value:'10',
                  label:'校核中'
                },
                {
                  value:'20',
                  label:'审核中'
                },
                {
                  value:'30',
                  label:'已完成'
                },
                
                
              ]"
              :key="index"
              :label="item.label"
              :value="item.value"
            />
            </el-select>
        
      </el-popover>
    </div>
      
     </template>


        <template #default="scope">
        
          <el-tag
            size="small"
            v-if="scope.row.equip_check === '10'"
            :type="setEquipStatus(scope.row.equip_check)"
            >校核中</el-tag
          >
          <el-tag
            size="small"
            v-if="scope.row.equip_check === '20'"
            :type="setEquipStatus(scope.row.equip_check)"
            >审核中</el-tag
          >
          <el-tag
            size="small"
            v-if="scope.row.equip_check === '30'"
            :type="setEquipStatus(scope.row.equip_check)"
            >已完成</el-tag
          >
          <el-tag
            size="small"
            v-if="
              scope.row.equip_check == '0'
            "
            :type="setEquipStatus(scope.row.equip_check)"
            >设计中</el-tag
          >
        </template>
      </el-table-column>
      <el-table-column
        fixed="right"
        label="模型状态"
        width="100"
        align="center"
      >


      <template  #header>
      <div style="display: flex;align-items: center;">
      <div style="margin-right: 5px;">  模型状态
      </div>
      <el-popover  :width="200"
    trigger="hover">
      
        
        <template #reference>
          <div class="icone" :class="model_stage_class.length==0?'':'active'">
        <el-icon><Filter /></el-icon>
      </div>
        </template>
        <el-select
        
        :teleported ='false'
           size="small"
              style="width: 180px; margin-right: 10px;z-index: 2000;"
              clearable
              filterable
              multiple
              collapse-tags
              collapse-tags-tooltip
             
              v-model="model_stage_class"
              @change="(text)=>changeFn(text,'model_stage_class')"
              placeholder="请输入"
             
            >
            <el-option
              v-for="(item, index) in [
             {
                  value:'0',
                 label:'设计中'
                },
                {
                  value:'10',
                  label:'校核中'
                },
                
                {
                  value:'20',
                  label:'已完成'
                },
                
                
              ]"
              :key="index"
              :label="item.label"
              :value="item.value"
            />
            </el-select>
        
      </el-popover>
    </div>
      
     </template>


        <template #default="scope">
        
          <el-tag
            size="small"
            v-if="scope.row.model_stage === '10'"
            :type="setEquipStatusModel(scope.row.model_stage)"
            >校核中</el-tag
          >
          <el-tag
            size="small"
            v-if="scope.row.model_stage === '20'"
            :type="setEquipStatusModel(scope.row.model_stage)"
            >已完成</el-tag
          >
         
          <el-tag
            size="small"
            v-if="
              scope.row.model_stage == '0'
            "
            :type="setEquipStatusModel(scope.row.model_stage)"
            >设计中</el-tag
          >
        </template>
      </el-table-column>
      <el-table-column fixed="right" label="操作" width="180" align="center">
        <template #default="{ row }">
          
          <el-button
            :disabled="row.drawing_stage =='施工图'||row.equip_version !== row.different[0].equip_version"
            link
            type="danger"
            size="small"
            @click="changeImage(row)"
            >转为施工图 </el-button
          >
          <el-button
            :disabled="row.equip_version !== row.different[0].equip_version"
            link
            type="primary"
            size="small"
            @click="editEquipment(row)"
            >编辑</el-button
          >

          <el-popconfirm
            placement="left"
            @confirm="deleteRow(row)"
            title="此操作将永久设备和设备关联的所有数据，确认删除?"
          >
            <template #reference>
              <el-button link type="danger" size="small">删除</el-button>
            </template>
          </el-popconfirm>
        </template>
      </el-table-column>
    </el-table>
    <el-dialog
      @close="closeFrom(destEquipInfoRefEdit)"
      title="编辑设备"
      v-model="newDio"
      width="25%"
    >
      <el-form
        ref="destEquipInfoRefEdit"
        size="small"
        :model="destEquipInfoEdit"
        :rules="destEquipInfoRulesEdit"
        label-width="100px"
      >
        <el-form-item label="主项代号" prop="unit_oid">
          <el-select
            size="small"
            style="width: 100%"
            v-model="destEquipInfoEdit.unit_oid"
            placeholder="请选择主项代号"
          >
            <el-option
              v-for="(item, index) in unit_oidOptions"
              :key="index"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="设备名称" prop="equip_name">
          <el-input
            size="small"
            v-model="destEquipInfoEdit.equip_name"
            placeholder="请输入设备名称"
          />
        </el-form-item>
        <el-form-item label="位号" prop="equip_no">
          <el-input
          disabled
            size="small"
            v-model="destEquipInfoEdit.equip_no"
            placeholder="请输入位号"
          />
        </el-form-item>
        <!-- <el-form-item label="设计阶段" prop="equip_class">
          <el-select-v2
            style="width: 100%"
            filterable
            :options="[
              { value: '工程图', label: '工程图' },
              { value: '施工图', label: '施工图' },
            ]"
            size="small"
            placeholder="请输入设计阶段"
            v-model="destEquipInfoEdit.drawing_stage"
          >
          </el-select-v2>
        </el-form-item> -->
        <el-form-item label="设备类型" prop="equip_class">
          <el-select-v2
            style="width: 100%"
            filterable
            :options="[
              { value: '换热器', label: '换热器' },
              { value: '容器', label: '容器' },
              { value: '塔器', label: '塔器' },
              { value: '反应器', label: '反应器' },
              { value: '大型储罐', label: '大型储罐' },
              { value: '球罐', label: '球罐' },
             
            ]"
            size="small"
            placeholder="请输入设备类型"
            v-model="destEquipInfoEdit.equip_class"
          >
          </el-select-v2>
        </el-form-item>
        <el-form-item label="安装方式" prop="installation_mode">
          <el-select-v2
            style="width: 100%"
            filterable
            :options="[
              { value: '鞍座', label: '鞍座' },
              { value: '裙座', label: '裙座' },
              { value: '耳座', label: '耳座' },
              { value: '刚性环', label: '刚性环' },
              { value: '支腿', label: '支腿' },
              { value: '支承式', label: '支承式' },
            
            ]"
            size="small"
            placeholder="请输入安装方式"
            v-model="destEquipInfoEdit.installation_mode"
          >
          </el-select-v2>
        </el-form-item>
        <el-form-item label="设备图号" prop="equip_dwg_no">
          <el-input
            size="small"
            v-model="destEquipInfoEdit.equip_dwg_no"
            placeholder="请输入设备图号"
          />
        </el-form-item>
        <el-form-item label="设备类别" prop="vessel_type">
          <!-- <el-input
            size="small"
            v-model="destEquipInfoEdit.vessel_type"
            placeholder="请输入容器类型"
          /> -->

          <el-select style="width: 100%"  size="small" placeholder="请输入设备类别"   v-model="destEquipInfoEdit.vessel_type" filterable>
            <el-option
             v-for="(item,index) in [
             {
                    value: 'Ⅰ',
                    label: 'Ⅰ',
                  },
                  {
                    value: 'Ⅱ',
                    label: 'Ⅱ',
                  },
                  {
                    value: 'Ⅲ',
                    label: 'Ⅲ',
                  },
 
                  {
                    value: 'I/SAD',
                    label: 'I/SAD',
                  },
                  {
                    value: 'II/SAD',
                    label: 'II/SAD',
                  },
                  {
                    value: 'III/SAD',
                    label: 'III/SAD',
                  },


                   {
                    value: '类外',
                    label: '类外',
                  },
             ]"
             :key="index"
             :label="item.label"
             :value="item.value"
            >

            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="台数" prop="equip_count">
          <el-input
            type="number"
            size="small"
            v-model="destEquipInfoEdit.equip_count"
            placeholder="请输入台数"
          />
        </el-form-item>
        <el-form-item label="空设备重量" prop="equip_dry_weight">
          <el-input
            type="number"
            size="small"
            v-model="destEquipInfoEdit.equip_dry_weight"
            placeholder="请输入重量"
          />
        </el-form-item>
        <el-form-item label="特材重量" prop="special_material_weight">
          <el-input
            type="number"
            size="small"
            v-model="destEquipInfoEdit.special_material_weight"
            placeholder="请输入重量"
          />
        </el-form-item>
        <el-form-item label="设计人" prop="equip_designer">
      
          <el-select
           :filter-method="matchFruitFirst"
          clearable
            style="width: 100%"
            filterable
          
           size="small"
            placeholder="请输入设计人"
            v-model="destEquipInfoEdit.equip_designer"
          >
          <el-option
         
           :label="item.label"
           :value="item.value"
           v-for="(item,index) in equip_designerOptions_PY"
           :key="index"
          >

          </el-option>
          </el-select>
        </el-form-item>
        <el-form-item  label="校核人" prop="equip_checker">
          <el-select
           :filter-method="matchFruitSecond"
          clearable
         
            style="width: 100%"
            filterable
          
            size="small"
            placeholder="请输入校核人"
            v-model="destEquipInfoEdit.equip_checker"
          >

          <el-option
         
           :label="item.label"
           :value="item.value"
           v-for="(item,index) in equip_checkerOptions_PY"
           :key="index"
          >

          </el-option>
          </el-select>
        </el-form-item>
        <el-form-item  label="审批人" prop="auditor">
          <el-select
           :filter-method="matchFruitThird"
           clearable
         
            style="width: 100%"
            filterable
          
            size="small"
            placeholder="请输入审批人"
            v-model="destEquipInfoEdit.auditor"
          >
          <el-option
         
         :label="item.label"
         :value="item.value"
         v-for="(item,index) in auditorOptions_PY"
         :key="index"
        >

        </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="审定人" prop="approver">
          <el-select
           :filter-method="matchFruitFour"
          clearable
            style="width: 100%"
            filterable
         
            size="small"
            placeholder="请输入审定人"
            v-model="destEquipInfoEdit.approver"
          >
          <el-option
         
         :label="item.label"
         :value="item.value"
         v-for="(item,index) in approverOptions_PY"
         :key="index"
        >

        </el-option>
          </el-select>
        </el-form-item>

      
        <!-- <el-form-item label="条件发送时间" prop="condition_iss_time">
			<el-date-picker
			style="width: 100%;"
        v-model="destEquipInfo.condition_iss_time"
        type="datetime"
        placeholder="选择条件发送时间"
		value-format="yyyy-MM-dd HH:mm:ss"
        format="yyyy-MM-dd HH:mm:ss"
        >
		</el-date-picker>"
     
         
        </el-form-item> -->
        <el-form-item>
          <div style="width: 100%; display: flex; flex-direction: row-reverse">
            <el-button @click="newDio = false">取 消</el-button>
            &nbsp;&nbsp;&nbsp;&nbsp;
            <el-button
              type="primary"
              @click="handleCopyEquipEdit(destEquipInfoRefEdit)"
              >确 定</el-button
            >
          </div>
        </el-form-item>
      </el-form>
    </el-dialog>

    <el-tooltip
      v-model:visible="visible"
      raw-content
      effect="light"
      trigger="click"
      virtual-triggering
      :virtual-ref="triggerRef"
    >
      <template #content>
        <el-descriptions class="margin-top" :column="3" size="small" border>
          <el-descriptions-item>
            <template #label>
              <div class="cell-item">主项</div>
            </template>
            {{ tooltipsData.equip_unit_no }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template #label>
              <div class="cell-item">设备名称</div>
            </template>
            {{ tooltipsData.equip_name }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template #label>
              <div class="cell-item">设备位号</div>
            </template>
            {{ tooltipsData.equip_no }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template #label>
              <div class="cell-item">设备种类</div>
            </template>
            {{ tooltipsData.equip_class }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template #label>
              <div class="cell-item">安装方式</div>
            </template>
            {{ tooltipsData.installation_mode }}
          </el-descriptions-item>

          <el-descriptions-item>
            <template #label>
              <div class="cell-item">设备图号</div>
            </template>
            {{ tooltipsData.equip_dwg_no }}
          </el-descriptions-item>

          <el-descriptions-item>
            <template #label>
              <div class="cell-item">设备类别</div>
            </template>
            {{ tooltipsData.vessel_type }}
          </el-descriptions-item>

          <el-descriptions-item>
            <template #label>
              <div class="cell-item">台数</div>
            </template>
            {{ tooltipsData.equip_count }}
          </el-descriptions-item>

          <el-descriptions-item>
            <template #label>
              <div class="cell-item">空设备质量</div>
            </template>
            {{ tooltipsData.equip_dry_weight }}
          </el-descriptions-item>

          <el-descriptions-item>
            <template #label>
              <div class="cell-item">特材重量</div>
            </template>
            {{ tooltipsData.special_material_weight }}
          </el-descriptions-item>

          <el-descriptions-item>
            <template #label>
              <div class="cell-item">设计人</div>
            </template>
            {{ tooltipsData.equip_designer }}
          </el-descriptions-item>

          <el-descriptions-item>
            <template #label>
              <div class="cell-item">校核人</div>
            </template>
            {{ tooltipsData.equip_checker }}
          </el-descriptions-item>

          <el-descriptions-item>
            <template #label>
              <div class="cell-item">审核人</div>
            </template>
            {{ tooltipsData.auditor }}
          </el-descriptions-item>

          <el-descriptions-item>
            <template #label>
              <div class="cell-item">审定人</div>
            </template>
            {{ tooltipsData.approver }}
          </el-descriptions-item>

          <el-descriptions-item>
            <template #label>
              <div class="cell-item">条件发送时间</div>
            </template>
            {{ tooltipsData.conditional_send_time }}
          </el-descriptions-item>

          <el-descriptions-item>
            <template #label>
              <div class="cell-item">设计完成时间</div>
            </template>
            {{ tooltipsData.design_finish_time }}
          </el-descriptions-item>

          <el-descriptions-item>
            <template #label>
              <div class="cell-item">校核完成时间</div>
            </template>
            {{ tooltipsData.check_finish_time }}
          </el-descriptions-item>

          <el-descriptions-item>
            <template #label>
              <div class="cell-item">审核完成时间</div>
            </template>
            {{ tooltipsData.review_finish_time }}
          </el-descriptions-item>

          <el-descriptions-item>
            <template #label>
              <div class="cell-item">返条件时间</div>
            </template>
            {{ tooltipsData.return_condition_time }}
          </el-descriptions-item>

          <el-descriptions-item>
            <template #label>
              <div class="cell-item">入库时间</div>
            </template>
            {{ tooltipsData.storage_time }}
          </el-descriptions-item>
        </el-descriptions>
      </template>
    </el-tooltip>
  </div>
</template>

<script setup>
import {Filter} from '@element-plus/icons-vue'
import { ElMessage, ElMessageBox } from "element-plus";
import { watch, ref ,onMounted} from "vue";
import { useRouter } from "vue-router";
import {
  UpgradeEquipFromEDToCD,
  UpgradeEquip,
  getproject,
  ReuseEquip,
  DeleteEquip,
  ModifyEquipV2,
  UpdateEquipCustomAttribute,
  UpdateEquipCustomAttVal,
} from "/@/api/equipment";
import { GetUnits , GetProjectUsers } from "/@/api/projectManage/projectList";
import PinYinMatch from "pinyin-match";
import { useEquipmentStore } from "../../../stores/equipment";
const props = defineProps(['custom_att1_val_option','Myproj_oid',"equipments",'equipOptions','equipEquip_no','nameOptions','equipEquip_class','installation_mode_class','equip_designer_class','equip_checker_class','auditor_class','approver_class','tableHeaderStr']);
let equipActive = ref("");
let store = useEquipmentStore();

let visible = ref(false);


function debounce(func, wait,immediate) {
  let timeout;

return function executedFunction(...args) {
  const context = this;
  if (timeout) clearTimeout(timeout);

  if (immediate) {
    // 如果已经立即执行过，不再执行
    const callNow = !timeout;
    timeout = setTimeout(() => {
      timeout = null;
    }, wait);
    if (callNow) func.apply(context, args);
  } else {
    timeout = setTimeout(() => {
      func.apply(context, args);
    }, wait);
  }
};
}

let moveSend = (e,dom) => {
  
  if(!document.querySelector('.my_input_not_send')?.contains(e.target)){

     if(dom.contains(e.target)){
  
    store.UpgradeEquipCount += 1;
   }
  }
 
}

onMounted(()=>{
 
  setTimeout(()=>{
    let dom =  document.querySelector(".move_class")
    let fn = debounce(moveSend,30,true)
    window.addEventListener("mousemove",(e)=>fn(e,dom) );
  },2000)
})

// 鼠标移入框显示的位置信息
const triggerRef = ref({
  getBoundingClientRect() {
    return position.value;
  },
});

// 删除整行
let deleteRow = async (row) => {
  await DeleteEquip({ equip_oid: row.equip_oid });
  store.UpgradeEquipCount += 1;
  ElMessage({
    message: "删除成功",
    type: "success",
  });
};


// 移入框的初始位置
const position = ref({
  top: 0,
  left: 0,
  bottom: 0,
  right: 0,
});

// 鼠标移动时候 位置不断更新
const mousemoveHandler = (e) => {
  position.value = DOMRect.fromRect({
    width: 0,
    height: 0,
    x: e.clientX,
    y: e.clientY,
  });
};

let tooltipsData = ref({});

// 鼠标移入 显示设备信息
let cellMouseEnter = (e, a2, a4, a5) => {
  if (a2.label == "设备位号") {
    tooltipsData.value = e;
    visible.value = true;
    mousemoveHandler(a5);
  } else {
  }
};

// 鼠标离开 信息消失
let cellMouseLeave = (e) => {
  visible.value = false;
};

let emit = defineEmits(["tableList",'SelectMajorFn','tableDataSend']);



// 当前版本的下拉框  将当前的信息过滤后进行保存
let revChange = (text, item) => {
  
  let data = item.different.filter((v) => v.equip_version === text)[0];
  item.equip_oid = data.equip_oid;
  item.equip_checker = data.equip_checker;
  item.equip_lastmodifytime = data.equip_lastmodifytime;
  item.equip_version = data.equip_version;
  item.design_finish_time = data.design_finish_time;
  item.return_condition_time = data.return_condition_time;
  item.equip_check = data.equip_check;
  // item.custom_att1_val=data.custom_att1_val
};


// 关闭弹窗
let closeFrom = () => {
  destEquipInfoRefEdit.value.resetFields();
};


let allProjList = ref([]);



let activeHeight = ref(0)


// 关于人员名称的拼音检索的逻辑
let equip_designerOptions_PY = ref([])
let matchFruitFirst = (searchContent) => {
  console.log(searchContent)
  if (searchContent) {
    let result = [];
    equip_designerOptions.value.forEach((item) => {
      // matchResult 的值为 true/false
      let matchResult = PinYinMatch.match(item.label, searchContent);
    
      if (matchResult) {
        result.push(item);
      }
    });
    
    equip_designerOptions_PY.value = result;
   
  } else {
    equip_designerOptions_PY.value = equip_designerOptions.value;
  }
}


let custom_att1_val_class = ref([])
let custom_att1_val_classPINGYING = ref([])
let approver_classPINGYING = ref([])
let approver_class = ref([])
let equip_check_class= ref([])
let model_stage_class = ref([])
let auditor_classPINGYING = ref([])
let auditor_class = ref([])
let equip_checker_class = ref([])
let equip_designer_classPINGYING = ref([])
let equip_checker_classPINGYING = ref([])



let matchFruitFirst_auditor_class = (searchContent) => {

if (searchContent) {
  let result = [];
  props.auditor_class.forEach((item) => {
    // matchResult 的值为 true/false
    let matchResult = PinYinMatch.match(item.label, searchContent);
  
    if (matchResult) {
      result.push(item);
    }
  });
  
  auditor_classPINGYING.value = result;
   
} else {
  auditor_classPINGYING.value = props.auditor_class;
}
}



let matchFruitFirst_approver_class = (searchContent) => {

if (searchContent) {
  let result = [];
  props.approver_class.forEach((item) => {
    // matchResult 的值为 true/false
    let matchResult = PinYinMatch.match(item.label, searchContent);
  
    if (matchResult) {
      result.push(item);
    }
  });
  
  approver_classPINGYING.value = result;
   
} else {
  approver_classPINGYING.value = props.approver_class;
}
}


let sortMethod = (a,b) => {
  if (!a.custom_att1_val) return 1;
  if (!b.custom_att1_val) return -1;
  if (a.custom_att1_val < b.custom_att1_val) {
        return -1;
      } else if (a.custom_att1_val > b.custom_att1_val) {
        return 1;
      } else {
        return 0;
      }

}


let matchFruitFirst_equip_designer_class = (searchContent) => {

  if (searchContent) {
    let result = [];
    props.equip_designer_class.forEach((item) => {
      // matchResult 的值为 true/false
      let matchResult = PinYinMatch.match(item.label, searchContent);
    
      if (matchResult) {
        result.push(item);
      }
    });
    
    equip_designer_classPINGYING.value = result;
 
  } else {
    equip_designer_classPINGYING.value = props.equip_designer_class;
  }
}



let changeInput =async (e,data) => {
  try {
    await UpdateEquipCustomAttVal({
    proj_oid:data.proj_oid,
    equip_no:data.equip_no,
    drawing_stage:data.drawing_stage,
    custom_att1:tableHeaderStrProps.value,
    custom_att1_val:data.custom_att1_val,
    user:JSON.parse(localStorage.getItem("userMessage")).user_account
 
  })

  }catch(e){
    ElMessage({
      message: "修改失败，请检查输入参数",
      type: "error",
    });
  }
 
  // store.UpgradeEquipCount += 1;
  
}

let changeHeader =async () => {
  if(props.tableHeaderStr&&props.tableHeaderStr !== tableHeaderStrProps.value){
  ElMessageBox.confirm(`您确定要修改表头吗？对应的表格内容会改变`, '提示', {
		confirmButtonText: '确定',
		cancelButtonText: '取消',
		type: 'warning',
	}).then(async ()=>{
    await UpdateEquipCustomAttribute({
    proj_oid:props.Myproj_oid,
    attributeDisplayName:tableHeaderStrProps.value,
    user:JSON.parse(localStorage.getItem("userMessage")).user_account
  })
  store.UpgradeEquipCount += 1;
  ElMessage({
    message: "表头修改成功",
    type: "success",
  })
  })
  .catch(()=>{
    tableHeaderStrProps.value = props.tableHeaderStr
  })
  }else{
    await UpdateEquipCustomAttribute({
    proj_oid:props.Myproj_oid,
    attributeDisplayName:tableHeaderStrProps.value,
    user:JSON.parse(localStorage.getItem("userMessage")).user_account
  })
  store.UpgradeEquipCount += 1;
  ElMessage({
    message: "表头修改成功",
    type: "success",
  })

  }
  
}



let matchFruitFirst_equip_checker_class = (searchContent) => {

if (searchContent) {
  let result = [];
  props.equip_checker_class.forEach((item) => {
    // matchResult 的值为 true/false
    let matchResult = PinYinMatch.match(item.label, searchContent);
  
    if (matchResult) {
      result.push(item);
    }
  });
  
  equip_checker_classPINGYING.value = result;
 
} else {
  equip_checker_classPINGYING.value = props.equip_checker_class;
}
}

let equip_checkerOptions_PY = ref([])

// 关于人员名称的拼音检索的逻辑
let matchFruitSecond = (searchContent) => {
  if (searchContent) {
    let result = [];
    equip_checkerOptions.value.forEach((item) => {
      // matchResult 的值为 true/false
      let matchResult = PinYinMatch.match(item.label, searchContent);
      if (matchResult) {
        result.push(item);
      }
    });
    equip_checkerOptions_PY.value = result;
  } else {
    equip_checkerOptions_PY.value = equip_checkerOptions.value;
  }
}


let auditorOptions_PY = ref([])
// 关于人员名称的拼音检索的逻辑
let matchFruitThird = (searchContent) => {
  if (searchContent) {
    let result = [];
    auditorOptions.value.forEach((item) => {
      // matchResult 的值为 true/false
      let matchResult = PinYinMatch.match(item.label, searchContent);
      if (matchResult) {
        result.push(item);
      }
    });
    auditorOptions_PY.value = result;
  } else {
    auditorOptions_PY.value = auditorOptions.value;
  }
}


let approverOptions_PY = ref([])
// 关于人员名称的拼音检索的逻辑
let matchFruitFour = (searchContent) => {
  if (searchContent) {
    let result = [];
    approverOptions.value.forEach((item) => {
      // matchResult 的值为 true/false
      let matchResult = PinYinMatch.match(item.label, searchContent);
      if (matchResult) {
        result.push(item);
      }
    });
    approverOptions_PY.value = result;
  } else {
    approverOptions_PY.value = approverOptions.value;
  }
}



let reuseOBJ = ref({});
let copyEquipFormVisible = ref(false);
// 将工程图转为施工图 
let changeImage = async (row) => {
  let res = await UpgradeEquipFromEDToCD({equip_oid:row.equip_oid})
  console.log(res)

  if(res == 'True'){
    ElMessage({
      type: "success",
      message: "转换成功",
    });
  }else{
    ElMessage({
      type: "error",
      message: res.data,
    });
  }
 
    store.UpgradeEquipCount += 1;
}


// 多选
let handleSelectionChange = (data) => {
  emit("tableList", data);
};


// 对返台返回的时间格式进行处理
let changeStr = (str) => {
  if (str) {
    if (str.includes("T")) {
      return str.replace("T", " ");
    } else {
      return str;
    }
  } else {
    return "";
  }
};

let destEquipInfoEdit = ref({
  unit_oid: "",
  equip_name: "",
  equip_no: "",
  equip_class: null,
  installation_mode: null,
  equip_dwg_no: "",
  vessel_type: "",
  equip_count: "",
  equip_dry_weight: "",
  special_material_weight: "",
  equip_designer: null,
  equip_checker: null,
  auditor: null,
  approver: null,drawing_stage:'工程图'
});
let destEquipInfoRulesEdit = ref({
  unit_oid: [{ required: true, message: "请输入主项号", trigger: "blur" }],
  equip_name: [{ required: true, message: "请输入设备名称", trigger: "blur" }],
  equip_no: [{ required: false, message: "请输入设备编号", trigger: "blur" }],
  equip_class: [
    { required: false, message: "请输入设备种类", trigger: "blur" },
  ],
  installation_mode: [
    { required: false, message: "请输入安装方式", trigger: "blur" },
  ],

  equip_dwg_no: [
    { required: false, message: "请输入设计图号", trigger: "blur" },
  ],
  vessel_type: [
    { required: false, message: "请输入容器类型", trigger: "blur" },
  ],
  equip_count: [{ required: false, message: "请输入台数", trigger: "blur" }],
  equip_dry_weight: [
    { required: false, message: "请输入空设备重量", trigger: "blur" },
  ],
  special_material_weight: [
    { required: false, message: "请输入特材重量", trigger: "blur" },
  ],
  equip_designer: [
    { required: false, message: "请输入设计人", trigger: "blur" },
  ],
  equip_checker: [
    { required: false, message: "请输入校核人", trigger: "blur" },
  ],
  auditor: [{ required: false, message: "请输入审批人", trigger: "blur" }],
  approver: [{ required: false, message: "请输入审定人", trigger: "blur" }],
});

let destEquipInfoRefEdit = ref("");
// 设备信息数据的修改
let handleCopyEquipEdit = (formEl) => {
  if (!formEl) return;
  formEl.validate(async (valid) => {
    if (valid) {
      // 保存数据
      await ModifyEquipV2(destEquipInfoEdit.value.proj_oid,destEquipInfoEdit.value.equip_no,destEquipInfoEdit.value.drawing_stage,{
        ...destEquipInfoEdit.value,
      });
      ElMessage({
        message: "修改成功",
        type: "success",
      });
      newDio.value = false;
      store.UpgradeEquipCount += 1;
    }
  });
};

// 设备的不同状态的格式的处理
let setEquipStatus = (status) => {
  if(status === "0") {
    equipActive.value = "设计中";
    return "info";
  }
  else if (status === "10") {
    equipActive.value = "审核中";
    return "";
  }
  else if(status === "20"){
    equipActive.value = "校核中";
    return "warning";
  }
  else if (status === "30") {
    equipActive.value = "已完成";
    return "success";
  } else{
     return 'info'
  }
};

let setEquipStatusModel = (status) =>{
  if(status === "0") {
    equipActive.value = "设计中";
    return "info";
  }
  else if (status === "10") {
    equipActive.value = "审核中";
    return "";
  } else if (status === "20") {
    equipActive.value = "已完成";
    return "success";
  } else{
     return 'info'
  }
}

let tableDatas = ref([]);
let table_Loading = ref(true)

let newDio = ref(false);


// 将同一设备的不同版本的数据进行重构，使其更好的检索，排序，下拉查看不同版本的设备
let changeData = (tableData) => {

 
  let data = JSON.parse(JSON.stringify(tableData)).map((v) => {
    return {
      ...v,
      different: [
        {
          custom_att1_val:v.custom_att1_val,
          equip_oid: v.equip_oid,
          equip_version: v.equip_version,
          value: v.equip_version,
          label: v.equip_version,
          design_finish_time: v.design_finish_time,
          return_condition_time: v.return_condition_time,
          equip_check: v.equip_check,
          equip_checker: v.equip_checker,
          equip_lastmodifytime: v.equip_lastmodifytime,
        },
      ],
    };
  });

  // 使用Map处理设备
  let map = new Map();
  data.forEach((v) => {
    
    if (map.has(`${v.equip_no} - ${v.drawing_stage}`)) {
 let obj = map.get(`${v.equip_no} - ${v.drawing_stage}`);
      if(obj.drawing_stage == v.drawing_stage){
 obj.different.push({
        custom_att1_val:v.custom_att1_val,
        equip_oid: v.equip_oid,
        equip_checker: v.equip_checker,
        equip_lastmodifytime: v.equip_lastmodifytime,
        equip_version: v.equip_version,
        value: v.equip_version,
        label: v.equip_version,
        design_finish_time: v.design_finish_time,
        return_condition_time: v.return_condition_time,
        equip_check: v.equip_check,
      });
      map.set(`${v.equip_no} - ${v.drawing_stage}`, obj);

      }else{
       map.set(`${v.equip_no} - ${v.drawing_stage}`, v);

      }
     
    } else {
      map.set(`${v.equip_no} - ${v.drawing_stage}`, v);
    }
  });

 
  let obj = [...map].map((v) => v[1]);
  // 对设备位号进行排序
  obj.sort((a, b) => {

  if (a.equip_unit_no && b.equip_unit_no) {
    if (a.equip_unit_no < b.equip_unit_no) return -1;
    if (a.equip_unit_no > b.equip_unit_no) return 1;
  } else if (a.equip_unit_no) {
    return -1;
  } else if (b.equip_unit_no) {
    return 1;
  }

  if (a.equip_no < b.equip_no) return -1;
  if (a.equip_no > b.equip_no) return 1;
// 对施工图和工程图进行排序
  const drawingStageOrder = { '工程图': 1, '施工图': 2 }; 
  if (a.drawing_stage && b.drawing_stage) {
    if (drawingStageOrder[a.drawing_stage] < drawingStageOrder[b.drawing_stage]) return -1;
    if (drawingStageOrder[a.drawing_stage] > drawingStageOrder[b.drawing_stage]) return 1;
  }

  return 0; // 如果都相同，则保持不变
});



  tableDatas.value = obj
  table_Loading.value = false
  emit('tableDataSend',obj)
};

// 自定义排序函数
let customSort = (a, b) => {
  // 判断 a 和 b 是否含有字母 R
  var aHasR = a.equip_version.includes("R");
  var bHasR = b.equip_version.includes("R");

  // 如果 a 和 b 都含有字母 R
  if (aHasR && bHasR) {
    // 提取 R 后的数字并转换为整数进行比较
    var aNum = parseInt(a.equip_version.substr(1));
    var bNum = parseInt(b.equip_version.substr(1));
    return bNum - aNum;
  }
  // 如果 a 和 b 都不含有字母 R
  else if (!aHasR && !bHasR) {
    // 直接比较字符串大小
    var aNum2 = parseInt(a.equip_version, 10);
    var bNum2 = parseInt(b.equip_version, 10);

    return bNum2 - aNum2;
  }
  // 如果一个含有字母 R，一个不含有
  else {
    // 含有字母 R 的排在前面
    return aHasR ? -1 : 1;
  }
};


let tableHeaderStrProps = ref('')

// 监听父组件是否有数据传回，如果有数据则往后渲染
watch(
  props,
  () => {
   
    if (props.equipments) {
      new Promise((resolve) => {
        tableHeaderStrProps.value = props.tableHeaderStr
        props.equipments.sort(customSort);

        resolve();
      }).then(() => {
        activeHeight.value= document.querySelector('.equip-list').clientHeight - 60
        
     
        changeData(props.equipments);

        equip_designer_classPINGYING.value = props.equip_designer_class
        equip_checker_classPINGYING.value = props.equip_checker_class
        auditor_classPINGYING.value = props.auditor_class
        approver_classPINGYING.value = props.approver_class
        custom_att1_val_classPINGYING.value = props.custom_att1_val_option
      });
    }
  },
  { immediate: true }
);

// 定义设备列表表头
const tableHeader = [
  {
    prop: "equip_unit_no",
    label: "主项",
    fixed: true,
    width: "100",
    sortable: true,
  },
 
  {
    prop: "equip_no",
    label: "设备位号",
    fixed: true,
    width: "130",
    sortable: true,
  },
  {
    prop: "equip_name",
    label: "设备名称",
    fixed: true,
    width: "130",
    sortable: true,
  },
 
  {
    prop: "equip_class",
    label: "设备种类",
    fixed: true,
    width: "120",
    sortable: false,
  },
  {
    prop: "installation_mode",
    label: "安装方式",
    fixed: false,
    width: "100",
    sortable: false,
  },
  {
    prop: "equip_dwg_no",
    label: "设备图号",
    fixed: false,
    width: "110",
    sortable: true,
  },
  {
    prop: "vessel_type",
    label: "设备类别",
    fixed: false,
    width: "90",
    sortable: false,
  },
  {
    prop: "equip_count",
    label: "台数",
    fixed: false,
    width: "70",
    sortable: false,
  },
  {
    prop: "equip_dry_weight",
    label: "空设备质量",
    fixed: false,
    width: "120",
    sortable: false,
  },
  {
    prop: "special_material_weight",
    label: "特材重量",
    width: "90",
    fixed: false,
    sortable: false,
  },
  {
    prop: "equip_designer",
    label: "设计人",
    fixed: false,
    width: "95",
    sortable: false,
  },
  {
    prop: "equip_checker",
    label: "校核人",
    fixed: false,
    width: "95",
    sortable: false,
  },
  {
    prop: "auditor",
    label: "审核人",
    fixed: false,
    width: "95",
    sortable: false,
  },
  {
    prop: "approver",
    label: "审定人",
    fixed: false,
    width: "95",
    sortable: false,
  },
  {
    prop: "conditional_send_time",
    label: "条件发送时间",
    fixed: false,
    width: "130",
    sortable: false,
  },
  {
    prop: "design_finish_time",
    label: "设计完成时间",
    fixed: false,
    width: "130",
    sortable: false,
  },
  {
    prop: "check_finish_time",
    label: "校核完成时间",
    fixed: false,
    width: "130",
    sortable: false,
  },
  {
    prop: "review_finish_time",
    label: "审核完成时间",
    fixed: false,
    width: "130",
    sortable: false,
  },
  {
    prop: "return_condition_time",
    label: "返条件时间",
    fixed: false,
    width: "120",
    sortable: false,
  },
  {
    prop: "storage_time",
    label: "入库时间",
    fixed: false,
    width: "90",
    sortable: false,
  },
  
];

let unit_oidOptions = ref([]);


// 编辑设备
const editEquipment = async (row) => {
  let res = await GetUnits({ proj_oid: row.proj_oid });

  if(res){
    unit_oidOptions.value = res.map((v) => {
    return {
      value: v.unit_oid,
      label: v.unit_no,
    };
  });
    }else{
      unit_oidOptions.value = [];
    }

    // 获取设备设计人
    equip_designerOptions.value = (await GetProjectUsers({ proj_oid: row.proj_oid , user_role: '设计人' })).map((v) => ({label:v.user_name,value:v.user_name}))
    // 获取设备设计人拼音码
    equip_designerOptions_PY.value = equip_designerOptions.value
    // 获取设备校核人
    equip_checkerOptions.value =  (await GetProjectUsers({ proj_oid: row.proj_oid , user_role: '校核人' })).map((v) => ({label:v.user_name,value:v.user_name}))
    // 获取设备校核人拼音码
    equip_checkerOptions_PY.value = equip_checkerOptions.value
    // 获取审计员
    auditorOptions.value = (await GetProjectUsers({ proj_oid: row.proj_oid , user_role: '审核人' })).map((v) => ({label:v.user_name,value:v.user_name}))
    // 获取审计员拼音码
    auditorOptions_PY.value = auditorOptions.value
    // 获取批准者
    approverOptions.value = (await GetProjectUsers({ proj_oid: row.proj_oid , user_role: '审定人' })).map((v) => ({label:v.user_name,value:v.user_name}))
    // 获取批准者拼音码
    approverOptions_PY.value = approverOptions.value
    newDio.value = true;
    console.log({...row})
    destEquipInfoEdit.value = { ...row };
};


let approverOptions = ref([])
let auditorOptions = ref([])
let equip_designerOptions = ref([])
let equip_checkerOptions = ref([])

let drawing_stage = ref([])

let SelectMajor = ref([])

let equip_nameInput = ref([])

let equipEquip_no = ref([])

let equipEquip_class = ref([])


let installation_mode_class = ref([])
let equip_designer_class = ref([])



let changeFn = (text,title) => {
  emit('SelectMajorFn',{text,title})
}


</script>

<style scoped lang="scss">
.create-del-equip {
  display: flex;
  justify-content: flex-end;
}

::v-deep(.mmy-table) {
  ::v-deep(.el-table--large) {
    ::v-deep(.el-table__cell) {
      padding: 6px 0;
    }
  }
}



.padding_content {
  padding: 10px;
  font-size: 12px;
  width: 300px;
  align-items: center;
  display: flex;
}
.active{
    color: rgb(24, 144, 255);
   }
   .icone{
    display: flex;
    align-items: center;
    justify-content: center;
   }
</style>
